\(\int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx\) [903]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 31, antiderivative size = 62 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\frac {i c^2}{2 f (a+i a \tan (e+f x))^4}-\frac {i a^2 c^2}{3 f \left (a^2+i a^2 \tan (e+f x)\right )^3} \]

[Out]

1/2*I*c^2/f/(a+I*a*tan(f*x+e))^4-1/3*I*a^2*c^2/f/(a^2+I*a^2*tan(f*x+e))^3

Rubi [A] (verified)

Time = 0.14 (sec) , antiderivative size = 62, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.097, Rules used = {3603, 3568, 45} \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\frac {i c^2}{2 f (a+i a \tan (e+f x))^4}-\frac {i a^2 c^2}{3 f \left (a^2+i a^2 \tan (e+f x)\right )^3} \]

[In]

Int[(c - I*c*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^4,x]

[Out]

((I/2)*c^2)/(f*(a + I*a*Tan[e + f*x])^4) - ((I/3)*a^2*c^2)/(f*(a^2 + I*a^2*Tan[e + f*x])^3)

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 3568

Int[sec[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Dist[1/(a^(m - 2)*b
*f), Subst[Int[(a - x)^(m/2 - 1)*(a + x)^(n + m/2 - 1), x], x, b*Tan[e + f*x]], x] /; FreeQ[{a, b, e, f, n}, x
] && EqQ[a^2 + b^2, 0] && IntegerQ[m/2]

Rule 3603

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.), x_Symbol] :> Di
st[a^m*c^m, Int[Sec[e + f*x]^(2*m)*(c + d*Tan[e + f*x])^(n - m), x], x] /; FreeQ[{a, b, c, d, e, f, n}, x] &&
EqQ[b*c + a*d, 0] && EqQ[a^2 + b^2, 0] && IntegerQ[m] &&  !(IGtQ[n, 0] && (LtQ[m, 0] || GtQ[m, n]))

Rubi steps \begin{align*} \text {integral}& = \left (a^2 c^2\right ) \int \frac {\sec ^4(e+f x)}{(a+i a \tan (e+f x))^6} \, dx \\ & = -\frac {\left (i c^2\right ) \text {Subst}\left (\int \frac {a-x}{(a+x)^5} \, dx,x,i a \tan (e+f x)\right )}{a f} \\ & = -\frac {\left (i c^2\right ) \text {Subst}\left (\int \left (\frac {2 a}{(a+x)^5}-\frac {1}{(a+x)^4}\right ) \, dx,x,i a \tan (e+f x)\right )}{a f} \\ & = \frac {i c^2}{2 f (a+i a \tan (e+f x))^4}-\frac {i c^2}{3 a f (a+i a \tan (e+f x))^3} \\ \end{align*}

Mathematica [A] (verified)

Time = 5.15 (sec) , antiderivative size = 37, normalized size of antiderivative = 0.60 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\frac {c^2 (i+2 \tan (e+f x))}{6 a^4 f (-i+\tan (e+f x))^4} \]

[In]

Integrate[(c - I*c*Tan[e + f*x])^2/(a + I*a*Tan[e + f*x])^4,x]

[Out]

(c^2*(I + 2*Tan[e + f*x]))/(6*a^4*f*(-I + Tan[e + f*x])^4)

Maple [A] (verified)

Time = 0.29 (sec) , antiderivative size = 39, normalized size of antiderivative = 0.63

method result size
derivativedivides \(\frac {c^{2} \left (\frac {1}{3 \left (\tan \left (f x +e \right )-i\right )^{3}}+\frac {i}{2 \left (\tan \left (f x +e \right )-i\right )^{4}}\right )}{f \,a^{4}}\) \(39\)
default \(\frac {c^{2} \left (\frac {1}{3 \left (\tan \left (f x +e \right )-i\right )^{3}}+\frac {i}{2 \left (\tan \left (f x +e \right )-i\right )^{4}}\right )}{f \,a^{4}}\) \(39\)
risch \(\frac {i c^{2} {\mathrm e}^{-4 i \left (f x +e \right )}}{16 a^{4} f}+\frac {i c^{2} {\mathrm e}^{-6 i \left (f x +e \right )}}{12 a^{4} f}+\frac {i c^{2} {\mathrm e}^{-8 i \left (f x +e \right )}}{32 a^{4} f}\) \(65\)
norman \(\frac {\frac {c^{2} \tan \left (f x +e \right )}{a f}+\frac {i c^{2}}{6 a f}-\frac {8 c^{2} \left (\tan ^{3}\left (f x +e \right )\right )}{3 a f}+\frac {c^{2} \left (\tan ^{5}\left (f x +e \right )\right )}{3 a f}-\frac {7 i c^{2} \left (\tan ^{2}\left (f x +e \right )\right )}{3 a f}+\frac {3 i c^{2} \left (\tan ^{4}\left (f x +e \right )\right )}{2 a f}}{\left (1+\tan ^{2}\left (f x +e \right )\right )^{4} a^{3}}\) \(124\)

[In]

int((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^4,x,method=_RETURNVERBOSE)

[Out]

1/f*c^2/a^4*(1/3/(tan(f*x+e)-I)^3+1/2*I/(tan(f*x+e)-I)^4)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 51, normalized size of antiderivative = 0.82 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\frac {{\left (6 i \, c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + 8 i \, c^{2} e^{\left (2 i \, f x + 2 i \, e\right )} + 3 i \, c^{2}\right )} e^{\left (-8 i \, f x - 8 i \, e\right )}}{96 \, a^{4} f} \]

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^4,x, algorithm="fricas")

[Out]

1/96*(6*I*c^2*e^(4*I*f*x + 4*I*e) + 8*I*c^2*e^(2*I*f*x + 2*I*e) + 3*I*c^2)*e^(-8*I*f*x - 8*I*e)/(a^4*f)

Sympy [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 151 vs. \(2 (49) = 98\).

Time = 0.24 (sec) , antiderivative size = 151, normalized size of antiderivative = 2.44 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\begin {cases} \frac {\left (384 i a^{8} c^{2} f^{2} e^{14 i e} e^{- 4 i f x} + 512 i a^{8} c^{2} f^{2} e^{12 i e} e^{- 6 i f x} + 192 i a^{8} c^{2} f^{2} e^{10 i e} e^{- 8 i f x}\right ) e^{- 18 i e}}{6144 a^{12} f^{3}} & \text {for}\: a^{12} f^{3} e^{18 i e} \neq 0 \\\frac {x \left (c^{2} e^{4 i e} + 2 c^{2} e^{2 i e} + c^{2}\right ) e^{- 8 i e}}{4 a^{4}} & \text {otherwise} \end {cases} \]

[In]

integrate((c-I*c*tan(f*x+e))**2/(a+I*a*tan(f*x+e))**4,x)

[Out]

Piecewise(((384*I*a**8*c**2*f**2*exp(14*I*e)*exp(-4*I*f*x) + 512*I*a**8*c**2*f**2*exp(12*I*e)*exp(-6*I*f*x) +
192*I*a**8*c**2*f**2*exp(10*I*e)*exp(-8*I*f*x))*exp(-18*I*e)/(6144*a**12*f**3), Ne(a**12*f**3*exp(18*I*e), 0))
, (x*(c**2*exp(4*I*e) + 2*c**2*exp(2*I*e) + c**2)*exp(-8*I*e)/(4*a**4), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\text {Exception raised: RuntimeError} \]

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^4,x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: expt: undefined: 0 to a negative exponent.

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 132 vs. \(2 (50) = 100\).

Time = 0.73 (sec) , antiderivative size = 132, normalized size of antiderivative = 2.13 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=-\frac {2 \, {\left (3 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{7} - 6 i \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{6} - 17 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{5} + 16 i \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{4} + 17 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{3} - 6 i \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 3 \, c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )\right )}}{3 \, a^{4} f {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{8}} \]

[In]

integrate((c-I*c*tan(f*x+e))^2/(a+I*a*tan(f*x+e))^4,x, algorithm="giac")

[Out]

-2/3*(3*c^2*tan(1/2*f*x + 1/2*e)^7 - 6*I*c^2*tan(1/2*f*x + 1/2*e)^6 - 17*c^2*tan(1/2*f*x + 1/2*e)^5 + 16*I*c^2
*tan(1/2*f*x + 1/2*e)^4 + 17*c^2*tan(1/2*f*x + 1/2*e)^3 - 6*I*c^2*tan(1/2*f*x + 1/2*e)^2 - 3*c^2*tan(1/2*f*x +
 1/2*e))/(a^4*f*(tan(1/2*f*x + 1/2*e) - I)^8)

Mupad [B] (verification not implemented)

Time = 6.27 (sec) , antiderivative size = 67, normalized size of antiderivative = 1.08 \[ \int \frac {(c-i c \tan (e+f x))^2}{(a+i a \tan (e+f x))^4} \, dx=\frac {c^2\,\left (-1+\mathrm {tan}\left (e+f\,x\right )\,2{}\mathrm {i}\right )}{6\,a^4\,f\,\left ({\mathrm {tan}\left (e+f\,x\right )}^4\,1{}\mathrm {i}+4\,{\mathrm {tan}\left (e+f\,x\right )}^3-{\mathrm {tan}\left (e+f\,x\right )}^2\,6{}\mathrm {i}-4\,\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )} \]

[In]

int((c - c*tan(e + f*x)*1i)^2/(a + a*tan(e + f*x)*1i)^4,x)

[Out]

(c^2*(tan(e + f*x)*2i - 1))/(6*a^4*f*(4*tan(e + f*x)^3 - tan(e + f*x)^2*6i - 4*tan(e + f*x) + tan(e + f*x)^4*1
i + 1i))